package com.example.infrastructure.domain.person.aggregate;

import com.example.infrastructure.domain.person.aggregate.valueObject.Gender;
import com.example.infrastructure.domain.person.aggregate.valueObject.PersonType;
import lombok.Data;

/**
 * TODO
 *
 * @author lxh
 * @date 2020/11/23 上午11:31
 **/
@Data
public class Person {
    private String personId;
    private String name;
    private Gender gender;
    private String mobile;
    private String orgId;
    private PersonType type = PersonType.EMPLOYEE;

    public void setGender(String gender) {
        this.gender = Gender.valueOf(gender.toUpperCase());
    }

    public void setGender(Gender gender) {
        this.gender = gender;
    }

    public static Person build() {
        return new Person();
    }

    public Person withOrg(String orgId) {
        this.setOrgId(orgId);
        return this;
    }

    public Person withType(PersonType type) {
        this.setType(type);
        return this;
    }
}
